/**
 * Created by Administrator on 2016/4/29 0029.
 */
import java.io.*;
import javax.sql.rowset.*;

public class TMessageUtil {
    public static void writXml(OutputStream outputStream)
        throws Exception{
        try(WebRowSet rowset = RowSetProvider.newFactory().createWebRowSet()){
                            rowset.setUrl("jdbc:mysql//localhost:3306/demo");
                            rowset.setUsername("root");
                            rowset.setpassword("openhome");
                            rowset.setCommand("SELECT * FORM t_message");
                            rowset.execude();
                            rowset.writeXml(outputStream);
        }
    }
    public static void main(String[] args) throws Exception {
        TMessageUtil.writeXml(System.out);
    }
}
